var pageii = null;
var grid = null;
$(function() {

	grid = lyGrid({
		pagId : 'paging',
		l_column : [
		   {
			colkey : "licenseNo",
			name : "车牌号"
		},{
			colkey : "tranDate",
			name : "日期",
			renderData : function(rowindex,data, rowdata, column) {
				return new Date(data).format("yyyy-MM-dd hh:mm:ss");
			}
		}, {
			colkey : "cname",
			name : "调度明细表客户"
		}, {
			colkey : "cname",
			name : "实际客户"
			
		}],
		jsonUrl : rootPath + '/transportDispatch/Customerdispatch_findbyPage.shtml',
		dymCol:true,
		checkbox : true,
		serNumber : false
	});
	
	$("#delFun").click("click", function() {
		delAccount();
	});
	$("#search").click("click", function() {// 绑定查询按扭
		var searchParams = $("#searchForm").serializeJson();
		grid.setOptions({
			data : searchParams
		});
	});
	
	
	function delAccount() {
		var cbox = grid.getSelectedCheckbox();
		if (cbox == "") {
			layer.msg("请选择删除项！！");
			return;
		}
		layer.confirm('是否删除？', function(index) {
			var url = rootPath + '/transportapply/transport_deleteEntity.shtml';
			var s = CommnUtil.ajax(url, {
				ids : cbox.join(",")
			}, "json");
			if (s == "success") {
				layer.msg('删除成功');
				grid.loadData();
			} else {
				layer.msg('删除失败');
			}
		});
	}
});